﻿using M.ShopMachine.Domain;
using M.ShopMachine.Read.WebApi.Application.Command.PatrolCommand;
using M.ShopMachine.Repository.Interface;
using MediatR;

namespace M.ShopMachine.Read.WebApi.Application.Handler.PatrolHandler
{
    public class GetTablePatrolHandler : IRequestHandler<GetTablePatrolCommand, List<Patrol>>
    {
        private readonly IPatrolRepository patrolRepository;

        public GetTablePatrolHandler(IPatrolRepository patrolRepository)
        {
            this.patrolRepository = patrolRepository;
        }

        public async Task<List<Patrol>> Handle(GetTablePatrolCommand request, CancellationToken cancellationToken)
        {
            return await patrolRepository.GetTablePatrolAsync(request.id);
        }
    }
}
